package com.googlecode.garbagecan.asmstudy.helloworld;

import org.objectweb.asm.MethodAdapter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

public class HelloWorldMethodAdapter extends MethodAdapter {
	
	public HelloWorldMethodAdapter(MethodVisitor mv) {
		super(mv);
	}

	public void visitCode() {
		visitMethodInsn(Opcodes.INVOKESTATIC, "com/googlecode/garbagecan/asmstudy/helloworld/HelloWorldInterceptor","before", "()V");
	}
	
	public void visitInsn(int opcodes) {
		if (opcodes == Opcodes.RETURN) {
			visitMethodInsn(Opcodes.INVOKESTATIC, "com/googlecode/garbagecan/asmstudy/helloworld/HelloWorldInterceptor","after", "()V");
		}
		mv.visitInsn(opcodes);
	}
}
